//
//  GRBuyDiscountSuccessVC.m
//  YC_GRice
//
//  Created by luojinrong11 on 2018/9/4.
//  Copyright © 2018年 YeCai. All rights reserved.
//

#import "GRBuyDiscountSuccessVC.h"
#import "MSTabBarController.h"
#import "ReturnIntegralView.h"
#import "GRRiceOrderDetailVCViewController.h"
@interface GRBuyDiscountSuccessVC ()
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;

@property (weak, nonatomic) IBOutlet UILabel *contentLabel;
@property(nonatomic,strong)ReturnIntegralView *intergralView ;

@end

@implementation GRBuyDiscountSuccessVC
-(ReturnIntegralView *)intergralView {
    if (!_intergralView) {
        _intergralView = [[ReturnIntegralView alloc]init];
    }
    return _intergralView;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    NSString * title; NSString * content;
      self.navigationItem.title = @"提交成功";
    if (self.type == BuyDiscountTypeSuccess) {
        title = @"购买成功";
        content = @"查看订单-【我的】-【我的订单】-【同城优惠】\n兑换时，请向商家出示二维码或验证码";
      
    }else if (self.type == BuyDiscountTypeCancleOrder){
        title = @"取消成功";
        content = @"查看订单-【我的】-【我的订单】-【同城优惠】";
    }else{
        title = @"退款成功";
        content = @"查看订单-【我的】-【我的订单】-【同城优惠】";
    }
    self.titleLabel.text = title;
    self.contentLabel.text = content;
    if (self.type == BuyDiscountTypeSuccess) {
        
        self.intergralView.integral = [NSString stringWithFormat:@"%.2lf",self.point];
        [self.intergralView showIntegral];
    }
    
}

- (IBAction)goBackHome:(id)sender {
    [MSTabBarController seletedTabIndex:0];
    [self.navigationController popToRootViewControllerAnimated:YES];
}


- (IBAction)lookOrderAction:(id)sender {
    GRRiceOrderDetailVCViewController * rice = [[GRRiceOrderDetailVCViewController alloc]init];
    rice.orderId = self.orderId;
    [self.navigationController pushViewController:rice animated:YES];
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
